package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.JtProductInventoryDetailsMapper;
import com.ruoyi.business.domain.JtProductInventoryDetails;
import com.ruoyi.business.service.IJtProductInventoryDetailsService;
import com.ruoyi.common.core.text.Convert;

/**
 * 商品库存明细Service业务层处理
 * 
 * @author Alan Zhang
 * @date 2025-06-13
 */
@Service
public class JtProductInventoryDetailsServiceImpl implements IJtProductInventoryDetailsService 
{
    @Autowired
    private JtProductInventoryDetailsMapper jtProductInventoryDetailsMapper;

    /**
     * 查询商品库存明细
     * 
     * @param detailsId 商品库存明细主键
     * @return 商品库存明细
     */
    @Override
    public JtProductInventoryDetails selectJtProductInventoryDetailsByDetailsId(Long detailsId)
    {
        return jtProductInventoryDetailsMapper.selectJtProductInventoryDetailsByDetailsId(detailsId);
    }

    /**
     * 查询商品库存明细列表
     * 
     * @param jtProductInventoryDetails 商品库存明细
     * @return 商品库存明细
     */
    @Override
    public List<JtProductInventoryDetails> selectJtProductInventoryDetailsList(JtProductInventoryDetails jtProductInventoryDetails)
    {
        return jtProductInventoryDetailsMapper.selectJtProductInventoryDetailsList(jtProductInventoryDetails);
    }

    /**
     * 新增商品库存明细
     * 
     * @param jtProductInventoryDetails 商品库存明细
     * @return 结果
     */
    @Override
    public int insertJtProductInventoryDetails(JtProductInventoryDetails jtProductInventoryDetails)
    {
        jtProductInventoryDetails.setCreateTime(DateUtils.getNowDate());
        return jtProductInventoryDetailsMapper.insertJtProductInventoryDetails(jtProductInventoryDetails);
    }

    /**
     * 修改商品库存明细
     * 
     * @param jtProductInventoryDetails 商品库存明细
     * @return 结果
     */
    @Override
    public int updateJtProductInventoryDetails(JtProductInventoryDetails jtProductInventoryDetails)
    {
        jtProductInventoryDetails.setUpdateTime(DateUtils.getNowDate());
        return jtProductInventoryDetailsMapper.updateJtProductInventoryDetails(jtProductInventoryDetails);
    }

    /**
     * 批量删除商品库存明细
     * 
     * @param detailsIds 需要删除的商品库存明细主键
     * @return 结果
     */
    @Override
    public int deleteJtProductInventoryDetailsByDetailsIds(String detailsIds)
    {
        return jtProductInventoryDetailsMapper.deleteJtProductInventoryDetailsByDetailsIds(Convert.toStrArray(detailsIds));
    }

    /**
     * 删除商品库存明细信息
     * 
     * @param detailsId 商品库存明细主键
     * @return 结果
     */
    @Override
    public int deleteJtProductInventoryDetailsByDetailsId(Long detailsId)
    {
        return jtProductInventoryDetailsMapper.deleteJtProductInventoryDetailsByDetailsId(detailsId);
    }
}
